<?php

/**
 * @author Martin Pernica
 * @copyright 2008
 */
function addLine($text, $data)
{
    echo '<tr><td style="text-align: left;"><strong>' . $text .
        '</strong></td><td style="text-align: right;">' . $data . '</td></tr>';
}

if ($q[1] == 'group') {


    $query = $GLOBALS['db']->query("SELECT * FROM " . $GLOBALS['db_prefix'] .
        "users_groups WHERE id = '" . intval($q[2]) . "' LIMIT 1");

    if ($query->num_rows == 0) {
        echo "<h2>".Lang::getFront('com_user', 'group_notfound')."</h2>";
    } else {

        $data = $query->fetch_array();

        Page::setTitle(Lang::getFront('com_user', 'group_headline') . ' - ' . $data['name']);

        echo '<h2>' . $data['name'] . '</h2>';
        echo '<table cellspacing="2" >';

        addLine(Lang::getFront('com_user', 'group_name'), $data['name']);
        addLine(Lang::getFront('com_user', 'group_description'), $data['description']);

        echo '<tr><th><h2>'.Lang::getFront('com_user', 'group_users').'</h2></th></tr>';
        $query = $db->query("SELECT id, display_name FROM {prefix}users WHERE `group` = '" .
            intval($q[2]) . "'");
        while ($users = $query->fetch_array()) {
            addLine('<a href="{url}user/single/' . $users['id'] . '">' . $users['display_name'] .
                '</a>', '');
        }
        echo '</table>';

    }
}

?>